package com.cn.domain;

import java.text.DecimalFormat;

//购物车需要显示的信息 有显示该商品的
   /*书名
    *图片 购买
            单价 购买
            数量 购买的
            金额   
            删除 操作  还有要结算的
            总价钱
       */
public class Cart {//单个书的总价钱
     private int number;//购买数量
     private Double totalPrice;//购买的总金额
     private Book book;
	 public int getNumber() {
		return number;
	}
	 public void setNumber(int number) {
		this.number = number;
	}

	 public Book getBook() {
		return book;
   }
	 public void setBook(Book book) {
		this.book = book;
   }
	 public Double getTotalPrice() {
		 double formtPrice = number*Double.valueOf(book.getPrice());
		 DecimalFormat df  = new DecimalFormat("0.00");
		 String newprice =df.format(formtPrice);
		 return  Double.valueOf(newprice);
		
	}
	public void setTotalPrice(Double totalPrice) {
		this.totalPrice = totalPrice;
	}
	 
}
